package singleton;

import cn.hutool.core.date.DateUtil;

/**
 * @Author: 582895699@qq.com
 * @Desctription: TODO
 * @Date: Created in 2021/12/7 22:09
 */
public class SingletonFour {

    private SingletonFour() {
        System.out.println("加载数据");
    }

    /**
     * 初始化静态数据时，Java提供了线程安全保障
     */
    private static class LazyHolder {
        private static final SingletonFour INSTANCE = new SingletonFour();
    }

    public static SingletonFour getInstance() {
        return LazyHolder.INSTANCE;
    }

    public String getTime() {
        return DateUtil.now();
    }
}
